/**
 * @FileDescription 消防设施api
 * @Author 祝小文
 * @CreateDate 2022-10-11 22:31
 */
import { chemical_server as request } from '@/service'

interface ResultType {
  result: {
    resultCode: string
    resultMessage: string
  }
  data: object
}

/** 适配接口返回结果 */
function adapter(response: ResultType) {
  if (response.result.resultCode == '000000') {
    return response.data
  }
  throw new Error()
}

//消防设施图标
export const queryMenuSsInfo = (params?: any) =>
  request.get(`/menu-ss/queryMenuSsInfo`, { params }).then((res) => adapter(res as any))

//消防设施打点信息
export const queryxfssDdByQyId = (params?: any) =>
  request.get(`/wzxxb/queryWzxxByQyIdAndBzLx`, { params }).then((res) => adapter(res as any))

//消防设施信息保存
export const upDateXfbfxx = (params?: any) =>
  request.post(`/xfbfxx/insertOrUpdate`, params).then((res) => adapter(res as any))
//消防设施泡沫站信息保存
export const upDatepmz = (params?: any) =>
  request.post(`/pmzxx/insertOrUpdate`, params).then((res) => adapter(res as any))
//消防设施消防水源信息保存
export const upDatexfsy = (params?: any) =>
  request.post(`/xfsh/insertOrUpdate`, params).then((res) => adapter(res as any))

export const upDatezrsy = (params?: any) =>
  request.post(`/trsy/insertOrUpdate`, params).then((res) => adapter(res as any))

export const queryxfsgwdd = (params?: any) =>
  request.get(`/xfsgwxx/queryXfsgwxxInfoList`, { params }).then((res) => adapter(res as any))

export const queryxfpmgw = (params?: any) =>
  request.get(`/xfpmgwxx/queryXfpmgwxxInfoList`, { params }).then((res) => adapter(res as any))

//消防水管网查询
export const queryXfsgwxx = (params?: any) =>
  request.get(`/xfsgwxx/queryXfsgwxxInfo`, { params }).then((res) => adapter(res as any))
//消防泡沫网查询
export const queryXfpm = (params?: any) =>
  request.get(`/xfpmgwxx/queryXfpmgwxxInfo`, { params }).then((res) => adapter(res as any))
//消防水管网新增
export const upDatxfsgwxx = (params?: any) =>
  request.post(`/xfsgwxx/insertOrUpdate`, params).then((res) => adapter(res as any))
// 消防泡沫管网新增
export const upDatxfpaomgw = (params?: any) =>
  request.post(`/xfpmgwxx/insertOrUpdate`, params).then((res) => adapter(res as any))
// 消火栓新增
export const upDatxhs = (params?: any) =>
  request.post(`/xhs/insertOrUpdate`, params).then((res) => adapter(res as any))
// 泡沫栓新增
export const upDatpms = (params?: any) =>
  request.post(`/pms/insertOrUpdate`, params).then((res) => adapter(res as any))
// 固定水炮新增
export const upDatgdsp = (params?: any) =>
  request.post(`/xfgdsp/insertOrUpdate`, params).then((res) => adapter(res as any))
// 固定泡沫炮新增
export const upDatgdpmp = (params?: any) =>
  request.post(`/xfgdpmp/insertOrUpdate`, params).then((res) => adapter(res as any))

//园区信息列表
export const queryYqxxZdInfo = (params?: any) =>
  request.get(`/zd-zdmc/queryYqxxZdInfo`, { params }).then((res) => adapter(res as any))

//根据qyid查询上次消火栓信息
export const queryXhsLastInfo = (params?: any) =>
  request.get(`/xhs/queryXhsLastInfo`, { params }).then((res) => adapter(res as any))

//根据qyid查询上次消防固定水炮信息
export const queryXfgdspLastInfo = (params?: any) =>
  request.get(`/xfgdsp/queryXfgdspLastInfo`, { params }).then((res) => adapter(res as any))

//根据qyid查询上次消防固定泡沫炮信息
export const queryXfgdpmpLastInfo = (params?: any) =>
  request.get(`/xfgdpmp/queryXfgdpmpLastInfo`, { params }).then((res) => adapter(res as any))

//根据qyid查询上次泡沫栓数据
export const queryPmsLastInfo = (params?: any) =>
  request.get(`/pms/queryPmsLastInfo`, { params }).then((res) => adapter(res as any))

//限宽
export const upDatexk = (params?: any) =>
  request.post(`/dl/insertOrUpdate`, params).then((res) => adapter(res as any))

//出入口
export const upDatecrk = (params?: any) =>
  request.post(`/crkxx/insertOrUpdate`, params).then((res) => adapter(res as any))

//应急事故池
export const upDateyjsgc = (params?: any) =>
  request.post(`/yjsgcxx/insertOrUpdate`, params).then((res) => adapter(res as any))

//dcs控制室
export const upDatedcskzs = (params?: any) =>
  request.post(`/dcskzsxx/insertOrUpdate`, params).then((res) => adapter(res as any))

//消防控制室
export const upDatexfkzs = (params?: any) =>
  request.post(`/xfkzsxx/insertOrUpdate`, params).then((res) => adapter(res as any))
